import java.util.Scanner;

public class Test {



    public static void main(String[] args) {
        //判断两个字符串是否相同
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        String str1 = scan.nextLine();
        String str2 = scan.nextLine();
        char[] arr1 = new char[str1.length()];
        char[] arr2 = new char[str2.length()];
        for (int i = 0; i < str1.length(); i++) {
            arr1[i] = str1.charAt(i);
        }
        for (int i = 0; i < str2.length(); i++) {
            arr2[i] = str2.charAt(i);
        }
        //1.排序
        for (int i = 0; i < str1.length()-1; i++) {
            for (int j = 0; j <str1.length()-1-i ; j++) {
                    if((int)arr1[j] > (int)arr1[j+1]) {
                        char tmp = arr1[j];
                        arr1[j] = arr1[j+1];
                        arr1[j+1] = tmp;
                    }
            }
        }
        for (int i = 0; i < str2.length()-1; i++) {
            for (int j = 0; j <str2.length()-1-i ; j++) {
                if((int)arr2[j] > (int)arr2[j+1]) {
                    char tmp = arr2[j];
                    arr2[j] = arr2[j+1];
                    arr2[j+1] = tmp;
                }
            }
        }
        //2.比较
        boolean bool = true;
        for (int i = 0; i < str1.length(); i++) {
            if(arr1[i] != arr2[i]) {
                bool = false;
                break;
            }
        }
        //3.判断结果
        if(str1.length() != str2.length()) {
            System.out.println("NO");
        }else {
            if(bool) {
                System.out.println("YES");
            }else  {
                System.out.println("NO");
            }
        }
        scan.close();
    }
    public static void main1(String[] args) {
        //检查是否唯一字符
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        String str = scan.nextLine();
        str = str.toLowerCase();
        boolean bool = true;
        flg:
        for (int i = 0; i < str.length()-1; i++) {
            for (int j = i+1; j < str.length(); j++) {
                if( str.charAt(i) == str.charAt(j)) {
                    bool = false;
                    break flg;
                }
            }
        }
        if(bool) {
            System.out.println("YES");
        }else {
            System.out.println("NO");
        }
        scan.close();
    }
}
